package com.kldy8.kldyw.find.project.bean;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/9/23.
 */
public class FilmProjectFilter
{
    public List<FilmProjectType> cpHootDateList;
    public  List<FilmProjectType>  cpReleaseTimeList;

    public static FilmProjectFilter resolution(JSONObject jsonObject)
    {
        if (jsonObject == null)
        {
            return  null;
        }
        FilmProjectFilter m_new = new FilmProjectFilter();
        JSONArray objectCpHootDate = jsonObject.optJSONArray("cp_hoot_date");
        JSONArray objectCpReleaseTime = jsonObject.optJSONArray("cp_release_time");

        if (null != objectCpHootDate && objectCpHootDate.length()>0)
        {
            m_new.cpHootDateList = new ArrayList<FilmProjectType>();
            for (int i = 0; i < objectCpHootDate.length(); i++)
            {
                JSONObject object = objectCpHootDate.optJSONObject(i);
                FilmProjectType cp_hoot_date = FilmProjectType.resolution(1,object);
                if (cp_hoot_date != null)
                {
                    m_new.cpHootDateList.add(cp_hoot_date);
                }
            }
        }

        if (null != objectCpReleaseTime && objectCpReleaseTime.length()>0)
        {
            m_new.cpReleaseTimeList = new ArrayList<FilmProjectType>();
            for (int i = 0; i < objectCpReleaseTime.length(); i++)
            {
                JSONObject object = objectCpReleaseTime.optJSONObject(i);
                FilmProjectType cp_hoot_date = FilmProjectType.resolution(2,object);
                if (cp_hoot_date != null)
                {
                    m_new.cpReleaseTimeList.add(cp_hoot_date);
                }
            }
        }
        return m_new;
    }
}
